-- MenuScene.lua
local MenuScene = class("MenuScene", function()
    return cc.Scene:create()
end)

function MenuScene:ctor()
    -- 获取可视区域大小
    local visibleSize = cc.Director:getInstance():getVisibleSize()
    local origin = cc.Director:getInstance():getVisibleOrigin()

    -- 创建一个标签
    --local label = cc.Label:createWithTTF("Hello, Axmol menu!", "Arial", 40)
    local lable = cc.Label:createWithSystemFont("Hello World1", "Arial", 40)
    if label then
        -- 设置标签的位置
        label:setPosition(cc.p(origin.x + visibleSize.width / 2,
                               origin.y + visibleSize.height - label:getContentSize().height))
        -- 将标签添加到当前场景
        self:addChild(label, 1)
    else
        print("Failed to load font")
    end

    -- 创建一个精灵
    local sprite = cc.Sprite:create("HelloWorld.png")
    if sprite then
        -- 设置精灵的位置
        sprite:setPosition(cc.p(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y))
        -- 将精灵添加到当前场景
        self:addChild(sprite, 0)
    else
        print("Failed to load image")
    end
end

function MenuScene:create()
    local scene = MenuScene.new()
    return scene
end

return MenuScene
